package cn.itsource.ymcc.doc;


import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;

//标记该对象是ES的文档对象
//indexName 索引库
//type 类型
@Document(indexName = "ymcc",type = "course")
@Data
public class CourseDoc {

    //标记为文档ID
    @Id
    private Long id;

    //课程标题需要分词，和指定分词器
    @Field(type = FieldType.Text,analyzer = "ik_max_word",searchAnalyzer = "ik_max_word")
    private String name;

    /**
     * 适用人群
     */
    @Field(type = FieldType.Keyword)
    private String forUser;
    /**
     * 课程分类
     */
    @Field(type = FieldType.Long)
    private Long courseTypeId;

    @Field(type = FieldType.Keyword)
    private Long courseTypeName;
    /**
     * 课程等级
     */
    @Field(type = FieldType.Keyword)
    private String gradeName;
    /**
     * 封面
     */
    @Field(type = FieldType.Keyword,index = false)
    private String pic;

    /**
     * 销量
     */
    @Field(type = FieldType.Integer)
    private Integer saleCount;
    /**
     * 浏览量
     */
    @Field(type = FieldType.Integer)
    private Integer viewCount;
    /**
     * 评论数
     */
    @Field(type = FieldType.Integer)
    private Integer commentCount;
    /**
     * 上线时间
     */
    @Field(type = FieldType.Date)
    private Date onlineTime;

    /**
     * 价格
     */
    @Field(type = FieldType.Double)
    private Double price;

    /**
     * 原价
     */
    @Field(type = FieldType.Double)
    private Double priceOld;

    /**
     * 收费规则
     */
    @Field(type = FieldType.Keyword)
    private String chargeName;

    @Field(type = FieldType.Keyword)
    private String teacherName;
}
